Statemine state migration runtime changes.#1743
Conversation
| pub struct MigController; | ||
| pub struct RootMigController; | ||
|
|
||
| const KEY_ROOT_MIG_CONTROLLER: [u8; 32] = [ | ||
| 82, 188, 113, 193, 236, 165, 53, 55, 73, 84, 45, 253, 240, 175, 151, 191, 118, 79, 156, 47, 68, | ||
| 232, 96, 205, 72, 95, 28, 216, 100, 0, 246, 73, | ||
| ]; | ||
|
|
||
| const KEY_MIG_CONTROLLER: [u8; 32] = [ | ||
| 82, 188, 113, 193, 236, 165, 53, 55, 73, 84, 45, 253, 240, 175, 151, 191, 118, 79, 156, 47, 68, | ||
| 232, 96, 205, 72, 95, 28, 216, 100, 0, 246, 73, | ||
| ]; | ||
|
|
||
| impl SortedMembers<AccountId> for RootMigController { | ||
| fn sorted_members() -> Vec<AccountId> { | ||
| // hardcoded key of controller for manual migration | ||
| vec![KEY_ROOT_MIG_CONTROLLER.into()] | ||
| } | ||
| } | ||
|
|
||
| impl SortedMembers<AccountId> for MigController { | ||
| fn sorted_members() -> Vec<AccountId> { | ||
| // hardcoded key of controller for manual migration | ||
| vec![KEY_MIG_CONTROLLER.into()] | ||
| } | ||
| } |
There was a problem hiding this comment.
| pub struct MigController; | |
| pub struct RootMigController; | |
| const KEY_ROOT_MIG_CONTROLLER: [u8; 32] = [ | |
| 82, 188, 113, 193, 236, 165, 53, 55, 73, 84, 45, 253, 240, 175, 151, 191, 118, 79, 156, 47, 68, | |
| 232, 96, 205, 72, 95, 28, 216, 100, 0, 246, 73, | |
| ]; | |
| const KEY_MIG_CONTROLLER: [u8; 32] = [ | |
| 82, 188, 113, 193, 236, 165, 53, 55, 73, 84, 45, 253, 240, 175, 151, 191, 118, 79, 156, 47, 68, | |
| 232, 96, 205, 72, 95, 28, 216, 100, 0, 246, 73, | |
| ]; | |
| impl SortedMembers<AccountId> for RootMigController { | |
| fn sorted_members() -> Vec<AccountId> { | |
| // hardcoded key of controller for manual migration | |
| vec![KEY_ROOT_MIG_CONTROLLER.into()] | |
| } | |
| } | |
| impl SortedMembers<AccountId> for MigController { | |
| fn sorted_members() -> Vec<AccountId> { | |
| // hardcoded key of controller for manual migration | |
| vec![KEY_MIG_CONTROLLER.into()] | |
| } | |
| } | |
| frame_support::ord_parameter_types! { | |
| pub const KEY_MIG_CONTROLLER = hex!("INSERT_HEX_STRING"); | |
| pub const KEY_ROOT_MIG_CONTROLLER = hex!("INSERT_HEX_STRING"); | |
| } | |
| const KEY_ROOT_MIG_CONTROLLER: [u8; 32] = [ | |
| 82, 188, 113, 193, 236, 165, 53, 55, 73, 84, 45, 253, 240, 175, 151, 191, 118, 79, 156, 47, 68, | |
| 232, 96, 205, 72, 95, 28, 216, 100, 0, 246, 73, | |
| ]; | |
| const KEY_MIG_CONTROLLER: [u8; 32] = [ | |
| 82, 188, 113, 193, 236, 165, 53, 55, 73, 84, 45, 253, 240, 175, 151, 191, 118, 79, 156, 47, 68, | |
| 232, 96, 205, 72, 95, 28, 216, 100, 0, 246, 73, | |
| ]; | |
| impl SortedMembers<AccountId> for RootMigController { | |
| fn sorted_members() -> Vec<AccountId> { | |
| // hardcoded key of controller for manual migration | |
| vec![KEY_ROOT_MIG_CONTROLLER.into()] | |
| } | |
| } | |
| impl SortedMembers<AccountId> for MigController { | |
| fn sorted_members() -> Vec<AccountId> { | |
| // hardcoded key of controller for manual migration | |
| vec![KEY_MIG_CONTROLLER.into()] | |
| } | |
| } |
| apis: RUNTIME_API_VERSIONS, | ||
| transaction_version: 8, | ||
| state_version: 0, | ||
| state_version: 1, |
There was a problem hiding this comment.
We should feature gate this for now.
As the GCP is still deploying the chain on Rococo for testing.
| Assets: pallet_assets::{Pallet, Call, Storage, Event<T>} = 50, | ||
| Uniques: pallet_uniques::{Pallet, Call, Storage, Event<T>} = 51, | ||
|
|
||
| StateTrieMigration: pallet_state_trie_migration = 52, |
| #[test] | ||
| fn ensure_key_ss58() { | ||
| use frame_support::traits::SortedMembers; | ||
| use sp_core::crypto::Ss58Codec; | ||
| let acc = | ||
| AccountId::from_ss58check("5DwBmEFPXRESyEam5SsQF1zbWSCn2kCjyLW51hJHXe9vW4xs").unwrap(); | ||
| //panic!("{:x?}", acc); | ||
| assert_eq!(acc, MigController::sorted_members()[0]); | ||
| let acc = | ||
| AccountId::from_ss58check("5DwBmEFPXRESyEam5SsQF1zbWSCn2kCjyLW51hJHXe9vW4xs").unwrap(); | ||
| assert_eq!(acc, RootMigController::sorted_members()[0]); | ||
| //panic!("{:x?}", acc); | ||
| } |
There was a problem hiding this comment.
I use it to ensure the controller account is correct (from the ss58 one).
I did check again why I did it in the first place, turns out Ss58Codec is behind 'full_crypto' feature and 'from_ss58check' is behind std.
I don't really see why from_ss58check could not be no_std, just would be a bit more work to switch it.
| type ControlOrigin = frame_system::EnsureSignedBy<RootMigController, AccountId>; | ||
| // specific account for the migration, can trigger the signed migrations. | ||
| type SignedFilter = frame_system::EnsureSignedBy<MigController, AccountId>; | ||
| //type SignedFilter = frame_system::EnsureSigned<Self::AccountId>; |
There was a problem hiding this comment.
| //type SignedFilter = frame_system::EnsureSigned<Self::AccountId>; |
kianenigma
left a comment
There was a problem hiding this comment.
Not sure if/why we need a new feature flag.
kianenigma
left a comment
There was a problem hiding this comment.
please merge #1424 (review) as well before starting the devops process.
|
bot merge |
|
Error: Statuses failed for 48642b3 |
|
bot merge |
|
Waiting for commit status. |
|
Merge cancelled due to error. Error: Statuses failed for 180ab19 |
|
bot merge |
|
Waiting for commit status. |
This PR contains runtime change to switch state mine to a hybrid trie state, as needed for https://github.com/paritytech/devops/issues/1508.
Note that the accounts need to be change to the rights KEY_ROOT_MIG_CONTROLLER and KEY_MIG_CONTROLLER that will be responsible for the migration. CC @PierreBesson